package com.workflow.workflowproject.entity;

import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.time.LocalDateTime;

import java.io.Serial;

import com.mybatisflex.core.keygen.KeyGenerators;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

/**
 *  实体类。
 *
 * @author sht05
 * @since 2024-11-04
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("t_com_flow_logs")
public class FlowLogs implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 流程日志ID
     */
    @Id
    private String id;

    /**
     * 业务ID
     */
    @Column(value = "bus_key")
    @Schema(description = "业务ID")
    private String busKey;

    /**
     * 流程ID
     */
    @Column(value = "process_instance_id")
    @Schema(description = "流程ID")
    private String processInstanceId;

    /**
     * 节点key
     */
    @Column(value = "node_key")
    @Schema(description = "节点key")
    private String nodeKey;

    /**
     * 流程名称
     */
    @Column(value = "task_name")
    @Schema(description = "流程名称")
    private String taskName;

    /**
     * 审批人员ID
     */
    @Column(value = "user_id")
    @Schema(description = "审批人员ID")
    private String userId;

    /**
     * 审批结果
     */
    @Column(value = "result")
    @Schema(description = "审批结果")
    private String result;
    /**
     * 类型
     */
    @Column(value = "type")
    @Schema(description = "类型")
    private String type;
    /**
     * 创建时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(value = "create_time",onInsertValue = "now()")
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(value = "update_time",onUpdateValue = "now()")
    @Schema(description = "修改时间")
    private LocalDateTime updateTime;

}
